package org.geektimes.configuration.microprofile.config.source;

import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.Map;
import java.util.Set;

/**
 * env
 *
 * @author 夜斗
 * @since 2021/3/21、2:27 下午
 */
public class EnvConfigSource implements ConfigSource {

    private final Map<String, String> properties;


    public EnvConfigSource() {
        this.properties = System.getenv();
    }

    @Override
    public Set<String> getPropertyNames() {
        return properties.keySet();
    }

    @Override
    public String getValue(String propertyName) {
        return properties.get(propertyName);
    }

    @Override
    public String getName() {
        return "Java System Properties";
    }
}
